package com.sgb.packers.view.adapter;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.packers.BR;
import com.sgb.packers.R;
import com.sgb.packers.entity.ProjectEntity;

import java.util.List;

/**
 * @author 王彬臣
 * @date 2021/11/25
 * @Description 项目管理列表
 */
public class ProjectListAdapter extends BaseQuickAdapter<ProjectEntity, BaseViewHolder> {

    public ProjectListAdapter(@Nullable @org.jetbrains.annotations.Nullable List<ProjectEntity> data) {
        super(R.layout.packers_item_project, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProjectEntity item) {
        ViewDataBinding binding = DataBindingUtil.bind(helper.itemView);
        if (binding != null) {
            binding.setVariable(BR.viewModel, item);
        }
        helper.addOnClickListener(R.id.tv_edit);
        helper.addOnClickListener(R.id.tv_del);
    }
}
